
package action;



import java.sql.Timestamp;
import java.util.*;

import models.*;

import models.IssueData;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class ViewIssueAction extends ActionSupport {
	Map<String, Object> session;
	int selected_issue_id;
	ArrayList<models.DeveloperData> DeveloperList=new ArrayList<models.DeveloperData>();
	ArrayList<models.TagData> TagList=new ArrayList<models.TagData>();
	
public ArrayList<models.DeveloperData> getDeveloperList() {
		return DeveloperList;
	}
	public void setDeveloperList(ArrayList<models.DeveloperData> developerList) {
		DeveloperList = developerList;
	}
public int getSelected_issue_id() {
		return selected_issue_id;
	}
	public void setSelected_issue_id(int selected_issue_id) {
		this.selected_issue_id = selected_issue_id;
	}
public String execute(){
	

    ArrayList<CommentData> commentslist = new ArrayList<CommentData>();
	commentslist = CommentData.find(" where issue_id = " +selected_issue_id+";");
	int i;
	 for(i=0;i<commentslist.size();i++){}
	 IssueData issue = new IssueData();
	 issue = IssueData.findOne(" where issue_id = " + selected_issue_id+";");
	 System.out.println("no. of comments "+i);
	session = ActionContext.getContext().getSession();
	session.put("comments",commentslist);
	session.put("selected_issue_id",selected_issue_id);
	session.put("Issue", issue);
	DeveloperList=models.DeveloperData.find("");
	session.put("DeveloperList",DeveloperList);
	TagList = models.TagData.tag_name_unique("");
	session.put("TagList",TagList);
	//System.out.println(commentslist.get(0).getComment());
	//System.out.println(commentslist.get(0).getDeveloperName());
	
	
	return "success";
}
}